home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disc 16
/
Commodore_Disc_16_19xx_-_de.d64
/
schiff versenken
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
18KB
|
470 lines
10 rem*****************************
20 rem***** ******
30 rem**** schiffeversenken ****
40 rem*** von ***
50 rem** horst sturhahn **
60 rem** rueterweg 130 **
70 rem** 4900 herford **
80 rem*** tel:05221/33264 ***
90 rem**** ****
95 rem*****************************
110 dima(15,15),b(15,15)
120 print"[147]";:poke53280,6:poke53281,6
130 print"[153]schiffeversenken[146][154]"
140 print:print"von[153]"
150 print:printtab(11)chr$(72);chr$(79);chr$(82);chr$(83);chr$(84);chr$(32);chr$(83);chr$(84);chr$(85);
160 printchr$(82);chr$(72);chr$(65);chr$(72);chr$(78)
170 print"[158]anleitung ? (j[146][153]:n[146][153])"
180 geta$:ifa$=""then170
190 ifa$="n"then750
200 ifa$<>"j"thenprint"falsche eingabe !!!":fort=1to1000:next:goto120
210 print:gosub650:forx=ito10
220 print" anleitung"
230 fort=1to100:next
240 print"anleitung[146]"
250 fort=1to100:next
260 next
270 print:print"schiffeversenken,besser bekannt als"
280 print:print"flottenmanoever,ist ein spiel gegen"
290 print:print"den computer.die spielbedienung erfolgt"
300 print:print"ueber tastatur a =rauf z =runter"
310 print". =links / =rechts"
320 print:print"oder joystick (port 2)."
330 print:print"aussuchen koennen sie die"
340 print:print"schussfolge,und einen von 3 schwierig-"
350 print:print"keitsgraden."
360 gosub680:gosub650
370 print:print" [158]anleitung[146]"
380 print:printtab(5)"sinn und zweck des spiels"
390 print:print:print"liegt darin,sechs vom computer"
400 print:print"versteckte schiffe aufzuspueren,und zu"
410 print:print"versenken,bevor es dem computer gelingt"
420 print:print"die eigene flotte zu vernichten."
430 print:print"die 6,zur flotte gehoerende schiffe,"
440 print:print"sind in 4 laengen unterteilt !"
450 gosub680:gosub650
460 print:print"[158]anleitung[146]"
470 print:printtab(10)"schiffslaengen":print
480 print:print" flugzeugtraeger[146] [152]laenge 5[146]"
490 print:print" zerstoerer[146] [152]laenge 4[146]"
500 print:print" flaggschiff[146] [152]laenge 4[146]"
510 print:print" u-boot[146] [152]laenge 3[146]"
520 print:print" minensuchboot[146] [152]laenge 3[146]"
530 print:print" schnellboot[146] [152]laenge 2[146]"
540 gosub680:gosub650
550 print:print"[158]anleitung[146]"
560 print:print"[155]wird waerend der schlacht ein treffer"
570 print:print"erzielt,bekommt der schuetze einen"
580 print:print"schuss dazu."
590 print:print"das spiel ist dann zuende,wenn es"
600 print:print"einem der beiden spieler gelungen ist"
610 print:print"alle schiffe des gegners zu versenken."
620 print:print:print"und nun viel spass !!"
630 gosub680
640 goto750
650 rem * programm-name u.p.g.m. *
660 print"[147]";"[153]schiffeversenken[146]"
670 return
680 print"[144]space"
690 geta$:ifa$=" "thenreturn
700 fori=1to70:next
710 print"[144]space[146]"
720 geta$:ifa$=" "thenreturn
730 fori=1to70:next
740 goto680
750 gosub650
760 print"gib deinen namen ein ! ";
770 aj=0:sn$="":rem * get-routine *
780 getaj$:ifaj$=""then780
790 ifaj$=chr$(13)then850
800 ifaj$=chr$(20)thenaj=aj-2:ifaj<0then760
810 aj=aj+1:ifaj>=10thenaj=10
820 sn$=sn$+aj$:sn$=left$(sn$,aj)
830 print" [157][157][157][157][157][157][157][157][157][157]";sn$
840 goto780
850 print" "
860 print:print:print"t[146] astaur oder j[146] oystick ?":print
870 getjt$:ifjt$="j"orjt$="t"then890
880 goto870
890 print:print"waehle spielstufe (1-3)":print
900 getss$
910 ss%=val(ss$):ifss%>0andss%<4then930
920 goto900
930 print:print"anzahl der schussfolge (1-5)"
940 getsv$
950 sv%=val(sv$):ifsv%>0andsv%<6then970
960 goto940
970 gc=1185:gs=1205:vc=55457:vs=55477
980 print"[147]"
990 tx=0:ty=0:tq=0:jp=56320:si=54272
1000 pokesi+3,15:pokesi+2,15
1010 pokesi+5,0*16+0:pokesi+6,13*16
1020 pokesi+24,15
1030 cn$="computer"
1040 gosub1570
1050 print"";:print"bitte einen moment geduld !"
1060 fore=1to15:fors=1to15
1070 a(e,s)=0:b(e,s)=0
1080 next:next
1090 rem ** schiffe-verstecken **
1100 x1=1:x2=1:vc=vs
1110 fori=1to2:fork=1to6
1120 ifi=2thenpokevc+x1,1:pokevc+x2*40,1:vc=55457:gosub1710:goto1540
1130 read y:read y$
1140 gosub2160
1150 printsn$;" waehle startkoordinate fuer"
1160 printy$;".nach auswahl"
1170 print"feuerknopf oder space druecken !"
1180 ifjt$="t"thengosub4480:goto1200
1190 gosub4100
1200 sx=x1:sy=x2
1210 ifa(x1,x2)=0then1240
1220 gosub2160
1230 goto1150
1240 a(x1,x2)=1:pokegs+x2*40+x1,102
1250 pokevs+x2*40+x1,0
1260 gosub4620
1270 gosub2160
1280 printsn$;" gib ausdehnungs-richtung":print
1290 print"w[146]=wagrecht s[146]=senkrecht ein"
1300 getd$:ifd$=""then1300
1310 ifd$="w"then1440
1320 ifd$<>"s"thengoto1300
1330 ifx2<=15-(y-1)then1350
1340 goto2290
1350 forh=1toy-1:pokegs+x2*40+x1+h*40,102:pokevs+x2*40+x1+h*40,0
1360 ifa(x1,x2+h)=0thengoto1410
1370 fort=0toh-1:pokegs+x2*40+x1+t*40,87:pokevs+x2*40+x1+t*40,14
1380 gosub4580
1390 a(x1,x2+t)=0:next
1400 goto1140
1410 a(x1,x2+h)=1
1420 gosub4620
1430 next:goto1540
1440 ifx1>15-(y-1)then2200
1450 forh=1toy-1:pokegs+x2*40+x1+h,102:pokevs+x2*40+x1+h,0
1460 ifa(x1+h,x2)=0then1510
1470 fort=0toh-1:pokegs+x2*40+x1+t,87:pokevs+x2*40+x1+t,14
1480 gosub4580
1490 a(x1+t,x2)=0:next
1500 goto1140
1510 a(x1+h,x2)=1
1520 gosub4620
1530 next:next
1540 gosub2160
1550 next:next
1560 goto2380
1570 rem ** bildaufbau **
1580 print"[147]";:poke53280,6:poke53281,6
1590 print"[153]schiffeversenken[146][154]"
1600 print:print:printtab(5)"[145][145]computer ";sn$;"[154]"
1610 fori=1to15
1620 printtab(2)"[215][215][215][215][215][215][215][215][215][215][215][215][215][215][215] [215][215][215][215][215][215][215][215][215][215][215][215][215][215][215]"
1630 next
1640 fort=1to15
1650 poke55457+t*40,1:poke55477+t*40,1
1660 poke1185+t*40,t:poke1205+t*40,t
1670 poke55457+t,1:poke55477+t,1
1680 poke1185+t,t:poke1205+t,t
1690 next
1700 return
1710 rem ** computer positioniert **
1720 rem ** seine schiffe **
1730 read y:read y$
1740 gosub2160
1750 print:printcn$;" positioniert ";"";y$;"[146]"
1760 foru=1to500:next
1770 gosub4620
1780 x1=int(rnd(0)*15+1)
1790 x2=int(rnd(0)*15+1)
1800 ifx2>15thenx2=15
1810 ifx1>15thenx1=15
1820 goto2130
1830 b(x1,x2)=1
1840 ifx1>15-yandx2>15-ythen1980
1850 ifx1>15-ythen1890
1860 ifx2>15-ythen1930
1870 l=int(rnd(0)*10)
1880 ifl<5then1930
1890 forh=1toy-1
1900 goto2080
1910 b(x1,x2+h)=1:gosub4620
1920 next:goto1970
1930 forh=1toy-1
1940 goto2040
1950 b(x1+h,x2)=1:gosub4620
1960 next
1970 return
1980 forh=1toy-1
1990 ifb(x1,x2-h)=0then2020
2000 fort=0toh-1:b(x1,x2-t)=0:gosub4580:next
2010 goto1740
2020 b(x1,x2-h)=1:gosub4620
2030 next:goto1970
2040 ifb(x1+h,x2)=0then2070
2050 fort=0toh-1:b(x1+t,x2)=0:gosub4580:next
2060 goto1740
2070 goto1950
2080 ifb(x1,x2+h)=0then2110
2090 fort=0toh-1:b(x1,x2+t)=0:gosub4580:next
2100 goto1740
2110 goto1910
2120 geta$:ifa$<>"j"then2120
2130 rem * koordinaten ueberpruefung *
2140 ifb(x1,x2)<>0then1780
2150 goto1830
2160 print""
2170 foru=1to3:print" ":next
2180 print""
2190 return
2200 forh=1toy-1:pokegs+x2*40+x1-h,102:pokevs+x2*40+x1-h,0
2210 ifa(x1-h,x2)=0then2260
2220 fort=0toh-1:pokegs+x2*40+x1-t,87:pokevs+x2*40+x1-t,14
2230 gosub4580
2240 a(x1-t,x2)=0:next
2250 goto1140
2260 gosub4620
2270 a(x1-h,x2)=1:next
2280 goto1550
2290 forh=1toy-1:pokegs+x2*40+x1-h*40,102:pokevs+x2*40+x1-h*40,0
2300 ifa(x1,x2-h)=0then2350
2310 fort=0toh-1:pokegs+x2*40+x1-t*40,87:pokevs+x2*40+x1-t*40,14
2320 gosub4580
2330 a(x1,x2-t)=0:next
2340 goto1140
2350 gosub4620
2360 a(x1,x2-h)=1
2370 goto1430
2380 rem * spiel *
2390 ts=0:tc=0:t=0:q=0
2400 sc=sv%
2410 gosub2160
2420 ift=2then2640
2430 gosub4370
2440 x1=sx:x2=sy
2450 print"nach auswahl der zielkoordinaten"
2460 print"feuerknopf oder space-taste druecken !"
2470 ifjt$="t"thengosub4480:goto2490
2480 gosub4100
2490 ifb(x1,x2)=0thengoto2560
2500 ifpeek(gc+x1+x2*40)<>87then2420
2510 pokegc+x1+x2*40,102:pokevc+x1+x2*40,0
2520 b(x1,x2)=0:gosub4270
2530 ts=ts+1:qs=qs+1:gosub4370
2540 gosub2160:gosub3290
2550 goto2610
2560 ifpeek(gc+x1+x2*40)<>87then2420
2570 pokegc+x1+x2*40,86:pokevc+x1+x2*40,15
2580 gosub4270
2590 sc=sc-1:qs=qs+1
2600 gosub4370
2610 ifsc<=0thent=2:goto2400
2620 ifts=21then3150
2630 goto2420
2640 gosub2160
2650 gosub4430
2660 print"computer schiesst"
2670 ifss%<2then2700
2680 ifz=0then2700
2690 onzgoto3490,3640,3790,3950
2700 x1=int(rnd(0)*15+1)
2710 x2=int(rnd(0)*15+1)
2720 ifx1<1thenx1=1
2730 ifx2<1thenx2=1
2740 ifx1>15thenx1=15
2750 ifx2>15thenx2=15
2760 ifa(x1,x2)=0thengoto2840
2770 ifpeek(vs+x1+x2*40)>0then2650
2780 pokevs+x1+x2*40,1
2790 a(x1,x2)=0:gosub4270
2800 tc=tc+1:q=q+1:z=1:tx=x1:ty=x2:qc=qc+1
2810 gosub4430
2820 gosub2160:gosub3290
2830 goto2910
2840 ifpeek(gs+x1+x2*40)<>87then2650
2850 ifss%<3then2870
2860 goto4300
2870 pokegs+x1+x2*40,86:pokevs+x1+x2*40,15
2880 gosub4270
2890 sc=sc-1:qc=qc+1
2900 gosub4430
2910 ifsc<=0thent=0
2920 iftc=21then2950
2930 ift=0then2400
2940 goto2650
2950 gosub2160
2960 rem * spiel verloren *
2970 print:print"schade aber sie haben"
2980 print"leider verloren[146] !!!"
2990 print"e[157] [157]n[157] [157]d[157] [157]e[146]"
3000 fort=1to2000:next
3010 gosub2160
3020 print:print"willst du wissen wo dein gegner"
3030 print"die restlichen schiffe versteckt hat ?"
3040 geta$:ifa$=""then3040
3050 ifa$="n"then3100
3060 ifa$="j"then3080
3070 goto3040
3080 gosub2160:fori=1to15:foru=1to15:ifb(u,i)=1thenpokegc+i*40+u,102:pokevc+i*40+u,0
3090 next:next:print"da sind die schiffe, die du nicht":print"getroffen hast !!!"
3100 fort=1to5000:next:gosub2160
3110 print"[145] [145]"
3120 print"[155]trefferquote c-64 :";int(100/(qc/tc));"%"
3130 print:print"[155]trefferquote ";sn$;":";int(100/(qs/ts));"%"
3140 gosub680:goto3240
3150 rem * spiel gewonnen *
3160 gosub2160
3170 print:print"[153]ich gratuliere"
3180 print"du hast gewonnen[146] !!!"
3190 print"e[157] [157]n[157] [157]d[157] [157]e[146]"
3200 fort=1to2000:next:gosub2160:print"[145] [145]"
3210 print"[155]trefferquote ";sn$;":";int(100/(qs/ts));"%"
3220 print:print"[155]trefferquote [153]c-64[155] :";int(100/(qc/tc));"%"
3230 gosub680
3240 restore:goto120
3250 data5,"flugzeugtraeger[146]",4,"zerstoerer[146]",4,"flaggschiff[146]",3,"u-boot[146]"
3260 data3,"minensuchboot[146]",2,"schnellboot[146]"
3270 data5,"flugzeugtraeger[146]",4,"zerstoerer[146]",4,"flaggschiff[146]",3,"u-boot[146]"
3280 data3,"minensuchboot[146]",2,"schnellboot[146]"
3290 rem * treffer meldung *
3300 pokesi+4,65
3310 ford=1to5
3320 print"";
3330 print"[158]t [150]r [153]e f f [153]e [150]r[146] [157][157][157][157]";
3340 ift=2then3370
3350 pokevc+x1+x2*40,10
3360 goto3380
3370 pokevs+x1+x2*40,10
3380 forl=1to50:pokesi+1,22:pokesi,l:next
3390 print"";
3400 print"[158]t [150]r [153]e f f [153]e [150]r [157][157][157][157]";
3410 ift=2then3440
3420 pokevc+x1+x2*40,1
3430 goto3450
3440 pokevs+x1+x2*40,1
3450 forl=1to50:pokesi+1,15+l:pokesi+7,l:next
3460 next:gosub2160
3470 pokesi,0:pokesi+1,0:pokesi+4,0:pokesi+7,0
3480 return
3490 rem * int.schiffevers. *
3500 d=0:z=1
3510 x1=x1+1
3520 ifx1>15thenx1=15:d=1
3530 ifd=1goto3640
3540 ifa(x1,x2)=1then3590
3550 ifpeek(gs+x1+x2*40)<>87then3640
3560 pokegs+x1+x2*40,86:pokevs+x1+x2*40,15:z=2
3570 gosub4270
3580 sc=sc-1:qc=qc+1:gosub4430:goto2910
3590 pokevs+x1+x2*40,1:q=q+1
3600 a(x1,x2)=0:gosub4270
3610 tc=tc+1:qc=qc+1:gosub4430
3620 gosub2160:gosub3290
3630 goto3490
3640 x1=tx:x2=ty
3650 x1=x1-1
3660 d=0:z=2
3670 ifx1<1thenx1=1:d=1
3680 ifd=1thengoto3790
3690 ifa(x1,x2)=1then3740
3700 ifpeek(gs+x1+x2*40)<>87then3790
3710 pokegs+x1+x2*40,86:pokevs+x1+x2*40,15:z=3
3720 gosub4270
3730 sc=sc-1:qc=qc+1:gosub4430:goto2910
3740 pokevs+x1+x2*40,1:q=q+1:tx=x1:ty=x2
3750 a(x1,x2)=0:gosub4270
3760 tc=tc+1:qc=qc+1:gosub4430
3770 gosub2160:gosub3290
3780 goto3650
3790 x1=tx:x2=ty
3800 x2=x2-1
3810 d=0:z=3
3820 ifx2<1thenx2=1:d=1
3830 ifd=1goto3950
3840 ifa(x1,x2)=1then3900
3850 ifpeek(gs+x1+x2*40)<>87then3950
3860 pokegs+x1+x2*40,86:pokevs+x1+x2*40,15:z=4
3870 gosub4270
3880 sc=sc-1:qc=qc+1:gosub4430:goto2910
3890 gosub4270
3900 pokevs+x1+x2*40,1
3910 a(x1,x2)=0:gosub4270
3920 tc=tc+1:qc=qc+1:gosub4430
3930 gosub2160:gosub3290
3940 goto3800
3950 x1=tx:x2=ty
3960 x2=x2+1
3970 d=0:z=4
3980 ifx2>15thenx2=15:d=1:z=0:q=0
3990 ifd=1then2910
4000 ifa(x1,x2)=1then4050
4010 ifpeek(gs+x1+x2*40)<>87thenz=0:goto2910
4020 pokegs+x1+x2*40,86:pokevs+x1+x2*40,15:z=0
4030 gosub4270
4040 sc=sc-1:qc=qc+1:gosub4430:goto2910
4050 pokevs+x1+x2*40,1:gosub4270
4060 tc=tc+1:qc=qc+1:gosub4430
4070 gosub2160:gosub3290
4080 a(x1,x2)=0
4090 goto3960
4100 rem * joy-abfrage *
4110 pokevc+x1,0:pokevc+x2*40,0
4120 sx=x1:sy=x2
4130 ifpeek(jp)=111then:return
4140 ifpeek(jp)=126thenpokevc+x2*40,1:x2=x2-1:gosub4190:gosub4660:goto4100
4150 ifpeek(jp)=119thenpokevc+x1,1:x1=x1+1:gosub4230:gosub4660:goto4100
4160 ifpeek(jp)=125thenpokevc+x2*40,1:x2=x2+1:gosub4190:gosub4660:goto4100
4170 ifpeek(jp)=123thenpokevc+x1,1:x1=x1-1:gosub4230:gosub4660:goto4100
4180 goto4100
4190 rem * bereichsueberschreitung x2 *
4200 ifx2<1thenx2=1
4210 ifx2>15thenx2=15
4220 return
4230 rem * bereichsueberschreitung x1 *
4240 ifx1<1thenx1=1
4250 ifx1>15thenx1=15
4260 return
4270 rem * ton fuer nicht-treffer *
4280 pokesi+4,65:forg=1to5:pokesi+1,g*g:pokesi,g:next:pokesi+1,0:pokesi,0
4290 return
4300 rem * uberpruefung *
4310 iftq=70thentq=0:ss%=2:goto2760
4320 ifpeek(gs+x1+x2*40-40)=86thentq=tq+1:goto2700
4330 ifpeek(gs+x1+x2*40+40)=86thentq=tq+1:goto2700
4340 ifpeek(gs+x1+1+x2*40)=86thentq=tq+1:goto2700
4350 ifpeek(gs+x1-1+x2*40)=86thentq=tq+1:goto2700
4360 tq=0:goto2870
4370 rem
4380 print"[155]schuss:";sc;" [155]treffer: [157][157][157]";ts;
4390 ifts=0thenwe=0:goto4410
4400 we=int(100/(qs/ts))
4410 print"[155]quote: [157][157][157][157][157]";we;"%"
4420 return
4430 print"[155]schuss:";sc;" [155]treffer: [157][157][157]";tc;
4440 iftc=0thenwe=0:goto4460
4450 we=int(100/(qc/tc))
4460 print"[155]quote: [157][157][157][157][157]";we;"%"
4470 return
4480 rem * tastaturabfrage *
4490 pokevc+x1,0:pokevc+x2*40,0
4500 getta$
4510 sx=x1:sy=x2
4520 ifta$=" "then:return
4530 ifta$="a"thenpokevc+x2*40,1:x2=x2-1:gosub4190:gosub4660:goto4480
4540 ifta$="/"thenpokevc+x1,1:x1=x1+1:gosub4230:gosub4660:goto4480
4550 ifta$="z"thenpokevc+x2*40,1:x2=x2+1:gosub4190:gosub4660:goto4480
4560 ifta$="."thenpokevc+x1,1:x1=x1-1:gosub4230:gosub4660:goto4480
4570 goto4480
4580 rem*geraeusch fuer schiff setzen*
4590 pokesi+4,17
4600 forsj=2to16:pokesi+1,sj*sj-(sj*1.8):pokesi,sj:next:pokesi+4,0
4610 return
4620 rem*geraeusch fuer schiff loeschen*
4630 pokesi+4,17
4640 forsj=16to2step-1:pokesi+1,sj*sj-(sj*1.8):pokesi,sj:next:pokesi+4,0
4650 return
4660 rem * ton fuer koordinaten *
4670 pokesi+4,17
4680 forsj=10to7step-1:pokesi+1,sj*sj-(sj*1.8):pokesi,sj:next:pokesi+4,0
4690 return